<%-- 
    Document   : orderList
    Created on : Nov 29, 2012, 3:43:34 PM
    Author     : minhtrungn
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
    <head>
    </head>
    <body onload="countCart();">
        <%@include file="/WEB-INF/headerMainPage.jsp" %>
        <div class="background-main" align="center">
            <c:set var="orderList" value="${requestScope.orderList}"/>
            <c:set var="orderDetail" value="${requestScope.orderDetail}"/>
            <div id="orderlist-wraper">
                <c:if test="${not empty orderList}">
                    <div id="orderlist">
                        <div id="order-dateCreated" style="font-weight: bold; border-bottom: solid 1px #F5F5F5; height: 35px;">Ngày đặt hàng
                        </div>
                        <div id="order-title" style="font-weight: bold; border-bottom: solid 1px #F5F5F5; height: 35px;">Đơn hàng
                        </div>
                        <div id="order-status" style="font-weight: bold; border-bottom: solid 1px #F5F5F5; height: 35px;">Trạng thái ĐH
                        </div>
                        <div id="order-total" style="font-weight: bold; border-bottom: solid 1px #F5F5F5; height: 35px;">Tổng tiền
                        </div>
                        <c:set var="count" value="0"/>
                        <c:forEach var="rows" items="${orderList}">
                            <c:set var="count" value="${count + 1}"/>
                            <input type="hidden" value="${count}"/>
                            <c:if test="${(count % 2) == 0}">
                                <div>
                                    <div id="order-dateCreated" align="center" style="background-color: lavender; cursor: pointer; height: 30px;" onclick="viewOrderDetails(${rows.orderID})">${rows.orderDate}
                                    </div>
                                    <div id="order-title" align="center" style="background-color: lavender; cursor: pointer; height: 30px;" onclick="viewOrderDetails(${rows.orderID})">${rows.orderID}
                                    </div>
                                    <div id="order-status" align="center" style="background-color: lavender; cursor: pointer; height: 30px;" onclick="viewOrderDetails(${rows.orderID})">${rows.status}
                                    </div>
                                    <div id="order-total" align="right" style="background-color: lavender; cursor: pointer; height: 30px;" onclick="viewOrderDetails(${rows.orderID})">${rows.orderTotal}
                                    </div>
                                </div>
                            </c:if>
                            <c:if test="${(count % 2) != 0}">
                                <div id="order-dateCreated" align="center" style="cursor: pointer; height: 30px;" onclick="viewOrderDetails(${rows.orderID})">${rows.orderDate}
                                </div>
                                <div id="order-title" align="center" style="cursor: pointer; height: 30px;" onclick="viewOrderDetails(${rows.orderID})">${rows.orderID}
                                </div>
                                <div id="order-status" align="center" style="cursor: pointer; height: 30px;" onclick="viewOrderDetails(${rows.orderID})">${rows.status}
                                </div>
                                <div id="order-total" align="right" style="cursor: pointer; height: 30px;" onclick="viewOrderDetails(${rows.orderID})">${rows.orderTotal}
                                </div>
                            </c:if>
                        </c:forEach>
                    </div>
                </c:if>
                <c:if test="${empty orderList}">
                    <div id="orderlist">
                        <div id="order-dateCreated" style="font-weight: bold; border-bottom: solid 1px #F5F5F5; height: 35px;">Ngày đặt hàng
                        </div>
                        <div id="order-title" style="font-weight: bold; border-bottom: solid 1px #F5F5F5; height: 35px;">Đơn hàng
                        </div>
                        <div id="order-status" style="font-weight: bold; border-bottom: solid 1px #F5F5F5; height: 35px;">Trạng thái ĐH
                        </div>
                        <div id="order-total" style="font-weight: bold; border-bottom: solid 1px #F5F5F5; height: 35px;">Tổng tiền
                        </div>
                        <div>Quý khách chưa có đơn hàng nào</div>
                    </div>
                </c:if>
                <c:if test="${not empty orderDetail}">
                    <div id="orderDetail">
                        <div id="orderDetail-productName" style="font-weight: bold; border-bottom: solid 1px #F5F5F5; height: 35px;">Tên sản phẩm
                        </div>
                        <div id="orderDetail-price" style="font-weight: bold; border-bottom: solid 1px #F5F5F5; height: 35px;">Đơn giá
                        </div>
                        <div id="orderDetail-quantity" style="font-weight: bold; border-bottom: solid 1px #F5F5F5; height: 35px;">Số lượng
                        </div>
                        <div id="orderDetail-total" style="font-weight: bold; border-bottom: solid 1px #F5F5F5; height: 35px;">Thành tiền
                        </div>
                        <c:set var="count" value="0"/>
                        <c:forEach var="detailRows" items="${orderDetail}">
                            <c:set var="count" value="${count + 1}"/>
                            <c:if test="${(count % 2) == 0}">
                                <div id="orderDetail-productName" style="background-color: skyblue; height: 30px;">${detailRows.productName}
                                </div>
                                <div id="orderDetail-price" style="background-color: skyblue; height: 30px;">${detailRows.price}
                                </div>
                                <div id="orderDetail-quantity" style="background-color: skyblue; height: 30px;">${detailRows.quantity}
                                </div>
                                <div id="orderDetail-total" style="background-color: skyblue; height: 30px;">${detailRows.total}
                                </div>
                            </c:if>
                            <c:if test="${(count % 2) != 0}">
                                <div id="orderDetail-productName" style="height: 30px;">${detailRows.productName}
                                </div>
                                <div id="orderDetail-price" style="height: 30px;">${detailRows.price}
                                </div>
                                <div id="orderDetail-quantity" style="height: 30px;">${detailRows.quantity}
                                </div>
                                <div id="orderDetail-total" style="height: 30px;">${detailRows.total}
                                </div>
                            </c:if>
                        </c:forEach>
                    </div>
                        <a id="print-pdf" target="_blank" href="PrintPDFServlet?btnAction=printPDF&orderID=${requestScope.orderID}">Xuất PDF</a>
                </c:if>
            </div>
        </div>
            <%@include file="/WEB-INF/footerMainPage.jsp" %>
    </body>
</html>
